\(\(\( (*\ 
      nahravanie\ externych\ prikazov\ *) \)\(
\)\(<< "C:/SymbOpt.m"\)\)\)

f[x1_, x2_] := 
      x1^2*x2 + x1*x2^3 - 
        x1*x2

  

    ?f

Plot3D[
      f[x1, x2], {x1, -2, 2}, {x2, -2, 2}, 
      AxesLabel -> {"x1", "x2", "x3"}]

ContourPlot[f[x1, x2], {x1, -1, 1}, {x2, -1, 1}, 
      FrameLabel -> {"x1", "x2"}, 
      Contours -> 50]

(* Presna analyza  -  inak povedane,  treba to vycislit,  
      lebo z grafu vidime velke nic  : -( *) 
 (* zadefinujeme si premennu X *)

x = {x1, x2}

(* ideme pouzit funkciu FOC,  tak pozrieme,  
      ze co pekne vlastne robi ...  *) 
?FOC

(* takze vieme,  
      First Order Conditions  =  
        Podmienky Prveho Radu *) 
 (* 
      uz nam nic nebrani dosadit tam nase Xko *) 
FOC[f[x1, x2], x]

(* toto netusim co je,  
        ale asi to bude derivacia,  
        a mozno dokonca aj parcialna ; -) *) 
D[f[x1, x2], x1]

stac = 
      Solve[FOC[f[x1, x2], x], x]

stac2 = 
      NSolve[FOC[f[x1, x2], x], x]

hes  =  Grad[Grad[f[x1, x2], x], x]  // 
        MatrixForm

h[i_] := 
      hes /. stac[[i]]

(* mno,  a tu uplne kompletka prestavam xapat,  
      co vlastne robime ; -(((( *) 

 (* 
      toto este xapem  -  
        vyberie mi to 4  
          ty prvok z mnoziny prvkov *) 
stac[[4]]

hes /. stac[[4]]  // 
      MatrixForm

(* 
      prve cislo zaporne  ->  minimum *) 
 (* 
      prve cislo kladne  ->  maximum *) 
 (* 
      druhe cislo je determinantom matice *) 
 (* Co pekne robi NaturalMinors ??  *) 
?NaturalMinors

NaturalMinors[h[4]]

Det[h[4]]

NaturalMinors[h[5]]

x1 =  
      x1 /. stac[[4, 1]]

x2  =  x2 /. stac[[4, 2]]

f[x1, x2]